package com.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Title: RemoveSession
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2023/12/25 13:34
 */
@WebServlet("/remove/session")
public class RemoveSession extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession session = req.getSession();
        // 删除掉key
       //  session.removeAttribute("user");
        // 销毁session
        session.invalidate();
        resp.getWriter().write("success!");
    }
}
